<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>管理后台</title>
    <link rel="stylesheet/less" href="../../../static/css/index.less"/>
    <link rel="stylesheet" href="../../../static/layui/css/layui.css"/>
    <link rel="stylesheet" href="../../../static/css/jquery.pagination.css"/>
    <script src="../../../static/js/jquery-1.12.3.js"></script>
    <script src="../../../static/js/less.min.js"></script>
    <script src="../../../static/layui/layui.js"></script>
    <script src="../../../static/js/ajaxfileupload.js"></script>
    <script src="../../../static/layer/layer.js"></script>
    <SCRIPT language=javascript src="../../static/layer/layer.js"></SCRIPT>
</head>
<style>
    #test1 {
        display: inline-block;
        width: 15%;
    }
</style>
<body class="layui-layout-body">

{% include "/admin/top.html" %}
{% include "/admin/left.html" %}

<div id="box" class="fl">
    <div class="content" style="height: 100%">
        <h3 style="color:  #3D89CB">商家购买列表</h3>
     <div class="search">
   <form action="/admin/pay/log.html" ,methods="GET">
            <label>选择商家：</label>
            <select id="uid" name="bid">
                <option value="">选择商家</option>
                {% if business %}
                {% for d in business %}
                <option value="{{ d.bid }}">{{ d.nickname }}</option>
                {% endfor %}
                {% endif %}
            </select>
            <label>开始日期：</label><input type="text" class="layui-input" id="test1"  value="{% if request.args.get('date1') != None %}{{ request.args.get('date1') }}{% endif %}"  name="date1" placeholder="请输入相应的日期" style="width: 150px">
            <label>结束日期：</label><input type="text" class="layui-input" id="test2"  value="{% if request.args.get('date2') != None %}{{ request.args.get('date2') }}{% endif %}" name="date2" placeholder="请输入相应的日期" style="width: 150px; display: inline-block;">
            <button class="sumbit" style="background-color:  #3D89CB">搜索</button>
   </form>
     </div>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <thead>
            <tr>
                <th width="10%">套餐名</th>
                <th>洗车次数</th>
                <th>支付金额</th>
                <th>微信名</th>
                <th>商户名</th>
                <th>支付类型</th>
                <th>创建时间</th>

            </tr>
            </thead>
            <tbody id="content">

                {% if res['res'] %}
                          <tr style="background-color: #0000001A">
                        <td>合计:{{ res.count }}条</td>
                              <td>{{ res.total_num }}</td>
                        <td>{{ res.total_money }}</td>
                        <td></td>
                        <td></td>
                            <td></td>
                        <td></td>

                        </tr>
                    {% for data in res['res'] %}
                        <tr>
                        <td>{{ data.name }}</td>
                        <td>{{ data.num1 }}</td>
                        <td>{{ data.pay_money}}</td>
                        <td>{{ data.wxNickName | default('', true) }}</td>
                        <td>{{ data.nickname }}</td>
                            <td>{% if data.pay_type==1 %}
                            余额支付
                            {% elif data.pay_type==2 %}
                            在线支付
                                {% else %}
                                系统添加
                            {% endif %}
                        <td>{{ data.add_time }}</td>

                        </td>
                        </tr>
                    {% endfor %}
                {% else %}
                   <tr></tr> <td colspan=8 align="center">暂无数据</td></tr>
                {% endif %}


            </tbody>
        </table>
        <div id="page" class="ui-pagination-container">
            {% if res.max_page > 0 %}
            <div class="ui-pagination-container">
                {% if res.page > 1 %}
                    <a href="/admin/pay/log.html?page=1{% if request.args.get('bid') %}&bid={{ request.args.get('bid') }}{% endif %}{% if request.args.get('date1') %}&date1={{ request.args.get('date1') }}{% endif %}{% if request.args.get('date2') %}&date2={{ request.args.get('date2') }}{% endif %}" class="ui-pagination-page-item"
                       data-current="1">首页</a>
                    <a href="/admin/pay/log.html?page={{ res.page - 1 }}{% if request.args.get('bid') %}&bid={{ request.args.get('bid') }}{% endif %}{% if request.args.get('date1') %}&date1={{ request.args.get('date1') }}{% endif %}{% if request.args.get('date2') %}&date2={{ request.args.get('date2') }}{% endif %}" class="ui-pagination-page-item"
                       data-current="1">上一页</a>
                {% endif %}
                {% if res.page - 2 > 0 %}
                    <a href="/admin/pay/log.html?page={{ res.page - 2 }}{% if request.args.get('bid') %}&bid={{ request.args.get('bid') }}{% endif %}{% if request.args.get('date1') %}&date1={{ request.args.get('date1') }}{% endif %}{% if request.args.get('date2') %}&date2={{ request.args.get('date2') }}{% endif %}" class="ui-pagination-page-item"
                       data-current="1">{{ res.page - 2 }}</a>
                {% endif %}
                {% if res.page - 1 > 0 %}
                    <a href="/admin/pay/log.html?page={{ res.page - 1 }}{% if request.args.get('bid') %}&bid={{ request.args.get('bid') }}{% endif %}{% if request.args.get('date1') %}&date1={{ request.args.get('date1') }}{% endif %}{% if request.args.get('date2') %}&date2={{ request.args.get('date2') }}{% endif %}" class="ui-pagination-page-item"
                       data-current="1">{{ res.page - 1 }}</a>
                {% endif %}
                <a href="javascript:void(0);" class="ui-pagination-page-item active"
                   data-current="2">{{ res.page }}</a>
                {% if res.page + 1 <= res.max_page %}
                    <a href="/admin/pay/log.html?page={{ res.page + 1 }}{% if request.args.get('bid') %}&bid={{ request.args.get('bid') }}{% endif %}{% if request.args.get('date1') %}&date1={{ request.args.get('date1') }}{% endif %}{% if request.args.get('date2') %}&date2={{ request.args.get('date2') }}{% endif %}" class="ui-pagination-page-item"
                       data-current="3">{{ res.page + 1 }}</a>
                {% endif %}
                {% if res.page + 2 <= res.max_page %}
                    <a href="/admin/pay/log.html?page={{ res.page + 2 }}{% if request.args.get('bid') %}&bid={{ request.args.get('bid') }}{% endif %}{% if request.args.get('date1') %}&date1={{ request.args.get('date1') }}{% endif %}{% if request.args.get('date2') %}&date2={{ request.args.get('date2') }}{% endif %}" class="ui-pagination-page-item"
                       data-current="3">{{ res.page + 2 }}</a>
                {% endif %}
                {% if res.page + 1 <= res.max_page %}
                    <a href="/admin/pay/log.html?page={{ res.page + 1 }}{% if request.args.get('bid') %}&bid={{ request.args.get('bid') }}{% endif %}{% if request.args.get('date1') %}&date1={{ request.args.get('date1') }}{% endif %}{% if request.args.get('date2') %}&date2={{ request.args.get('date2') }}{% endif %}" class="ui-pagination-page-item"
                       data-current="3">下一页</a>
                    <a href="/admin/pay/log.html?page={{ res.max_page }}{% if request.args.get('bid') %}&bid={{ request.args.get('bid') }}{% endif %}{% if request.args.get('date1') %}&date1={{ request.args.get('date1') }}{% endif %}{% if request.args.get('date2') %}&date2={{ request.args.get('date2') }}{% endif %}" class="ui-pagination-page-item"
                       data-current="12">尾页</a>
                {% endif %}
            </div>
        {% endif %}
        </div>
    </div>
</div>
</div>
<input type="hidden" value="1" id="p">
</body>
</html>
<script>
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#test1', //指定元素
        });


    });
        $(function () {
        var se = document.getElementById('uid');
        se.onchange = function () {
            localStorage.value = this.value;
            localStorage.index = this.selectedIndex;
            console.log(localStorage.index + ";" + localStorage.value);
        };
        window.onload = function () {
            if (localStorage.index)
                try {
                    se.options[localStorage.index].selected = true;

                } catch (err) {

                }
        };
    })


</script>
